import sys

if len(sys.argv) != 4:
    print("用法：python calculator.py <数字1> <运算符> <数字2>")
    sys.exit(1)

num1 = float(sys.argv[1])
op = sys.argv[2]
num2 = float(sys.argv[3])

if op == "+":
    result = num1 + num2
elif op == "-":
    result = num1 - num2
else:
    print("仅支持加减法！")
    sys.exit(1)

print(f"结果：{num1} {op} {num2} = {result}")

# python calculator.py 5 + 3  # 输出：结果：5.0 + 3.0 = 8.0  
